using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CodeWork.Library.Web;
using CodeWork.BLL;

public partial class public_Activation : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Title = "Activation";

        if (ValidateConfirmation())
            lblActivationMessage.Text = @"Your registration is complete. You can now login using your 
            User ID and Password. <br/>Click <a href='" + ResolveUrl("~/public/login.aspx") + "'>here</a> to login";
        else
            lblActivationMessage.Text = @"Invalid confirmation request. May be your registration confirmation 
            period is over. All requests are canceled withing 7 days if not verified.";    
    }

    private bool ValidateConfirmation()
    {
        string account = Request["account"];
        string confirmationCode = Request["confirmationCode"];

        if (!string.IsNullOrEmpty(account) && !string.IsNullOrEmpty(confirmationCode))
            return UserManager.VerifyRegistrationConfirmation(account, confirmationCode);
        else
            return false;
    }
}
